with SDL; 
package Cairo.CairoSDL is


private
   use SDL;

   CAIROSDL_ASHIFT : constant := 24;
   CAIROSDL_RSHIFT : constant := 16;
   CAIROSDL_GSHIFT : constant :=  8;
   CAIROSDL_BSHIFT : constant :=  0;
   CAIROSDL_AMASK  : constant := 255 * (2 ** CAIROSDL_ASHIFT);
   CAIROSDL_RMASK  : constant := 255 * (2 ** CAIROSDL_RSHIFT);
   CAIROSDL_GMASK  : constant := 255 * (2 ** CAIROSDL_GSHIFT);
   CAIROSDL_BMASK  : constant := 255 * (2 ** CAIROSDL_BSHIFT);

   ASHIFT : constant := CAIROSDL_ASHIFT;
   RSHIFT : constant := ((24 + ASHIFT) mod 32);
   GSHIFT : constant := ((16 + ASHIFT) mod 32);
   BSHIFT : constant := (( 8 + ASHIFT) mod 32);

   AMASK : constant := 255 * (2 ** ASHIFT);
   RMASK : constant := 255 * (2 ** RSHIFT);
   GMASK : constant := 255 * (2 ** GSHIFT);
   BMASK : constant := 255 * (2 ** BSHIFT);

   RECIPROCAL_BITS : constant := 16;

   type Reciprocal_Table_Type is array(Uint32_t range 0 .. 255) of Uint32_t;

   procedure Init (Table : in out Reciprocal_Table_Type);

   type Pixel_Line_Type is array(Natural range <>) of Uint32_t;


   function Cell_Div (A, B : Uint32_t) return Uint32_t;

   function Shift (X : Uint32_t; Y : Integer) return Uint32_t; 
      
   function To_Pixel (R, G, B, A : Uint32_t) return Uint32_t;

   procedure Extract_Cairo_Pixel (RGBA : Uint32_t; R, G, B, A : out Uint32_t);

   procedure Extract_SDL_Pixel (RGBA : Uint32_t; R, G, B, A : out Uint32_t);

   procedure Unpremultiply_Row (
      Dst : in out Pixel_Line_Type;
      Src : Pixel_Line_Type;
      Num_Pixels : Natural
      );

   procedure Premultiply_Row (
      Dst : in out Pixel_Line_Type;
      Src : Pixel_Line_Type;
      Num_Pixels : Natural
      );


   procedure Blit_And_Unpremultiply (
      Target_Buffer : in out Pixel_Line_Type;
      Target_Stride : Natural;
      Source_Buffer : Pixel_Line_Type;
      Source_Stride : Natural;
      Width, Height : Natural
      );

   procedure Blit_And_Premultiply (
      Target_Buffer : in out Pixel_Line_Type;
      Target_Stride : Natural;
      Source_Buffer : Pixel_Line_Type;
      Source_Stride : Natural;
      Width, Height : Natural
      );
   



end Cairo.CairoSDL;
